<?php

namespace app\common\service;

use think\Db;
use app\common\service\BalanceService;
use app\common\service\InvestService;

class CrontabService{
	private static $usdt_id = 2;
	


	public static function huilv(){
		$res = curl('http://web.juhe.cn:8080/finance/exchange/rmbquot?type=&bank=&key=65a9172109bfec94a456576a3329f2f3');
		$data = json_decode($res,true);
		if($data['error_code'] != 0){
			$huilv = 6.9;
		} else {
			foreach ($data['result']['list'] as $key => $val) {
				if($val[0]=='美元'){
					$huilv = $val[2]/100;
				}
			}
		}
		$re = Db::name('coin')->where('id',2)->update([
			'price'=>1,
			'rmb'  =>$huilv
		]);
		return $re;
	}
}